<?php 
if (count($this->messageThreads) == 0) {
	?>
	
	<div class="noResults">It's empty, no mail yet ... </div>
	
<div class="dotline"></div>
	<?php
} else {
foreach ($this->messageThreads as $thread) {
	$user = $thread->displayUser;
?>  

<li <?php if (!$thread->read) {?>class="unread"<?php }?>>
<div class="msgImg">
	<img src="<?php echo $this->userThumbnail($user);?>" />
	<?php 
$uc = User::checkUserAuthProvider($user, AuthProvider::FACEBOOK);
if (!empty($uc)) {
?><a target="_blank" id="fbIcon" title="<?php echo $user->name;?> has connected with Facebook, isn't he/she more trustworthy? Click to check out!" href="http://www.facebook.com/profile.php?id=<?php echo $uc->auth_uid;?>">
fb</a>
<?php }?>
</div>	
<div class="msgName">
		<a href="<?php echo $this->url(array('controller'=>'user', "action"=>"profile", "uid"=>$user->id), "default", true)?>"><?php echo $user->name;?></a>
		<span><?php echo $thread->lastMessageCreated;?></span>
</div>
<div class="msgDesc">
	<h2><a style="float:left;" href="<?php echo $this->url(array('controller'=>'message', "action"=>"view", "tid"=>$thread->threadId), "default", true)?>"><?php echo empty($thread->subject) ? "(No Subject)" : $thread->subject;?></a>
	 <?php if (!$thread->read) {?><span class="unreadIcon">New</span><?php }?>
	</h2>
	<span><?php echo substr($thread->displayMessage,0,100)."...";;?></span>
</div>

</li>

<div class="dotline"></div>
<?php }}
?>